<template>
    <div>
        <el-dropdown @command="getFile">
            <span class="el-dropdown-link">{{ t('供货商') }}<el-icon class="el-icon--right"><arrow-down /></el-icon></span>
            <template #dropdown>
                <el-dropdown-menu>
                    <!-- <el-dropdown-item :icon="FolderRemove">{{ t('打包下载') }}</el-dropdown-item> -->
                    <el-dropdown-item :icon="Tickets" command="quotation">{{ t('报价单') }}</el-dropdown-item>
                    <el-dropdown-item :icon="Tickets" command="pi">{{ t('Proforma Invoice') }}</el-dropdown-item>
                    <!-- <el-dropdown-item :icon="Tickets">{{ t('Commercial Invoice') }}</el-dropdown-item> -->
                    <!-- <el-dropdown-item :icon="Document">{{ t('Packing List') }}</el-dropdown-item> -->
                </el-dropdown-menu>
            </template>
        </el-dropdown>
    </div>
</template>

<script setup lang="ts">
import { reactive, ref, inject, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import type baTableClass from '/@/utils/baTable'
import FormItem from '/@/components/formItem/index.vue'
import type { ElForm } from 'element-plus'
import { ElMessage } from 'element-plus'
import { useFilter } from '/@/stores/filter'

import {
    ArrowDown,
    Check,
    CircleCheck,
    CirclePlus,
    CirclePlusFilled,
    Plus,
    Tickets,
    Document,
    FolderRemove
} from '@element-plus/icons-vue'

// import { batchOrderFileApi } from '/@/api/most/customer/order'

const filter = useFilter();

const formRef = ref<InstanceType<typeof ElForm>>()
const baTable = inject('baTable') as baTableClass

const { t } = useI18n()

import { generateFileApi } from '/@/api/most/customer/generate'

const props = defineProps(['order_id'])


const getFile = (type: string) => {
    // alert(type + props.order_id)
    // alert(props.order_id)
    let data = {
        order_id: props.order_id,
        type: type
    }
    generateFileApi(data).then((e) => {
        console.log(e)
        window.open(e.data.file)
    })
}



onMounted(() => {
})

</script>

<style scoped lang="scss">

.el-dropdown-link {
  display: flex;
  align-items: center;
  cursor: pointer;
}

</style>
